{% extends "default/sell/signup_wizard_base.html" %}

{% load i18n %}

{% block step %}

	{% block tinyMCE %}
		<script type="text/javascript" src="{{ STATIC_URL }}js/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="{% url tinymce-js 'default' %}"></script>
	{% endblock %}
	
	{% comment %}
	<!-- 
	<script type="text/javascript" src="{{ STATIC_URL}}js/tiny_mce/tiny_mce.js"></script>
	<script type="text/javascript">
	tinyMCE.init({
		mode : "textareas",	
		theme : "advanced",
		readonly : true ,
	});
	 -->
	{% endcomment %}

$(document).ready(function(){
	$("#id_2-shop_address").click(function(){
	if ($("#id_2-shop_address").is(":checked")){
	    //show the hidden div
	    $("#address_fields").hide("fast");
	}
	else{     
	    //otherwise, hide it
	    $("#address_fields").show("fast");
	}
	});
	
	$('form').submit(function(){
		$('input[type=submit]').attr("disabled", "disabled");		
	});
});
</script>

<form id="form" name="form" method="post" action="." class="form-stacked span8 offset2" id="wizard">
	{% if form.non_field_errors %} Error : <div class="alert-message block-message error">{{ form.non_field_errors }}</div>{% endif %}
	{% csrf_token %}
	
	<fieldset>	
		<label>{{ form.shop_address.label }}</label>{{ form.shop_address }}	
	</fieldset>
	
	<div id="address_fields">
	
	{% if form.billing_street.errors %}<div class="alert-message block-message error">{{ form.billing_street.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.billing_street.label.title }}</label>
	{{ form.billing_street }}
	<br></br>
	{% if form.billing_city.errors %}<div class="alert-message block-message error">{{ form.billing_city.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.billing_city.label.title }}</label>
	{{ form.billing_city }}	
	<br></br>
	{% if form.billing_state.errors %}<div class="alert-message block-message error">{{ form.billing_state.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.billing_state.label.title }}</label>
	{{ form.billing_state }}
	<br></br>
	{% if form.billing_zip.errors %}<div class="alert-message block-message error">{{ form.billing_zip.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.billing_zip.label.title }}</label>
	{{ form.billing_zip }}
	<br></br>
	</div>
		
	{% if form.cc_number.errors %}<div class="alert-message block-message error">{{ form.cc_number.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.cc_number.label.title }}</label>
	{{ form.cc_number }}
	
	{% if form.cc_expiration_month.errors %}<div class="alert-message block-message error">{{ form.cc_expiration_month.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.cc_expiration_month.label.title }}</label>
	{{ form.cc_expiration_month }}
	<br></br>
	{% if form.cc_expiration_year.errors %}<div class="alert-message block-message error">{{ form.cc_expiration_year.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.cc_expiration_year.label.title }}</label>
	{{ form.cc_expiration_year }}
	<br></br>
	{% if form.card_security_number.errors %}<div class="alert-message block-message error">{{ form.card_security_number.errors|join:", " }}</div>{% endif %}	
	<label>{{ form.card_security_number.label.title }}</label>
	{{ form.card_security_number }}
	
	{% if form.terms.label.title == "Terms" %}
	<label>Terms</label>
	<textarea rows="10" cols="140">
	{{ marketplace.termsandconditions_set.all.0.text }}
	</textarea>
	<label>{{ form.terms }} I Agree</label>
	{% else %}
	{{ form.terms }} {{ form.terms.help_text }}
	{% endif %}
	<input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />
	{{ previous_fields|safe }}

	<div class="buttonHolder">
		<br/>
<div class="submit-active"> 



	<button id="ButtonBuy" type="submit" class="btn primary">{% trans "Buy" %}</button>
       	<input type="hidden" name="next" value="{{ next|escape }}" />
</div>
<div class="submit-passive" style="display: none;"> 
        <input type="button" class="btn primary disable" value="Buy" disabled>
   </div>




    </div>
	
	
</form>


<script>

$(document).ready(function() {
    $("#form").submit(function() {
        $("#form .submit-active, #form .submit-passive").toggle();
    });
});

</script>


 
{% endblock %}
